-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the capability to assimilate the MADIS snow depth data from GTS #1836
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each of these different steps should probably be broken into individual methods that prepare_GTS
calls, as it is getting a bit long now and doing multiple things. Will see what @aerorahul thinks.
if os.path.isfile(f"{os.path.join(localconf.DATA, output_file)}"): | ||
rm_p(output_file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if os.path.isfile(f"{os.path.join(localconf.DATA, output_file)}"): | |
rm_p(output_file) | |
rm_p(output_file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above lines were removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good. We can work to make it better and data driven.
parm/config/gfs/config.preplandobs
Outdated
export BUFRADPSFCYAML="${HOMEgfs}/sorc/gdas.cd/test/testinput/bufr_adpsfc_snow.yaml" | ||
export BUFRSNOCVRYAML="${HOMEgfs}/sorc/gdas.cd/test/testinput/bufr_snocvr.yaml" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these yamls be in parm/land/
and not test/
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the GTS bufr2ioda yamls in GDASApp are saved at the test/testinput/
directory.
logger.info(f"Executing {exe}") | ||
try: | ||
exe() | ||
except OSError: | ||
raise OSError(f"Failed to execute {exe}") | ||
except Exception: | ||
raise WorkflowException(f"An error occured during execution of {exe}") | ||
|
||
output_file = f"{localconf.OPREFIX}snocvr_snow.nc4" | ||
if os.path.isfile(f"{os.path.join(localconf.DATA, output_file)}"): | ||
rm_p(output_file) | ||
|
||
# execute BUFR2IODAX to convert snocvr bufr data into IODA format | ||
yaml_file = f"bufr_snocvr.yaml" | ||
if not os.path.isfile(f"{os.path.join(localconf.DATA, yaml_file)}"): | ||
logger.exception(f"{yaml_file} not found") | ||
raise FileNotFoundError(f"{os.path.join(localconf.DATA, yaml_file)}") | ||
exe = Executable(self.task_config.BUFR2IODAX) | ||
exe.add_default_arg(os.path.join(localconf.DATA, f"{yaml_file}")) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a suggestion to remove some repetition here. Please see the patch on this file if you could kindly test.
diff.txt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tested this, and it worked perfect. The updates were committed to the repo. Thanks @aerorahul for your suggestions.
# generate bufr2ioda YAML files | ||
adpsfc_yaml = os.path.join(self.runtime_config.DATA, "bufr_adpsfc_snow.yaml") | ||
logger.info(f"Generate BUFR2IODA YAML file: {adpsfc_yaml}") | ||
temp_yaml = parse_j2yaml(self.task_config.BUFRADPSFCYAML, self.task_config) | ||
save_as_yaml(temp_yaml, adpsfc_yaml) | ||
logger.info(f"Wrote bufr2ioda YAML to: {adpsfc_yaml}") | ||
snocvr_yaml = os.path.join(self.runtime_config.DATA, "bufr_snocvr.yaml") | ||
logger.info(f"Generate BUFR2IODA YAML file: {snocvr_yaml}") | ||
temp_yaml = parse_j2yaml(self.task_config.BUFRSNOCVRYAML, self.task_config) | ||
save_as_yaml(temp_yaml, snocvr_yaml) | ||
logger.info(f"Wrote bufr2ioda YAML to: {snocvr_yaml}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we may be able to make this a bit less hard-coded and yaml driven from the top.
Say for e.g. somewhere in GDASApp/parm/land has bufr2ioda.yaml
that contains:
bufr2ioda:
adpsfc: {{ HOMEgfs }}/sorc/gdas.cd/test/testinput/bufr_adpsfc_snow.yaml
snocvr: {{ HOMEgfs }}/sorc/gdas.cd/test/testinput/bufr_snocvr.yaml
We could then loop over this list to parse the yamls, and call the bufr2ioda.x
and verify the output is produced.
The code then does not know what it is processing and bufr files can be added/removed to the yaml.
Would this be acceptable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we may be able to use land/prep/prep_gts.yaml
as it already seems to have the appropriate information and it is likely better to keep them together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aerorahul Follow your suggestions, I have made the changes for your review. Thanks.
# generate bufr2ioda YAML files | ||
for name in ["adpsfc", "snocvr"]: | ||
gts_yaml = os.path.join(self.runtime_config.DATA, f"bufr_{name}_snow.yaml") | ||
logger.info(f"Generate BUFR2IODA YAML file: {gts_yaml}") | ||
temp_yaml = parse_j2yaml(prep_gts_config.bufr2ioda[name], localconf) | ||
save_as_yaml(temp_yaml, gts_yaml) | ||
logger.info(f"Wrote bufr2ioda YAML to: {gts_yaml}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating this section @jiaruidong2017
Here is what I was suggesting.
In the attached patch, you will notice that I have removed any knowledge of what is being converted from bufr to ioda in the python script. The control comes directly from the yaml.
Would you be willing to give this a try?
diff.txt
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @aerorahul. I will try it and let you know then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aerorahul I just tested and it worked perfectly. The changes have been committed to the repo.
# execute BUFR2IODAX to convert snocvr bufr data into IODA format | ||
_gtsbufr2iodax(exe, os.path.join(localconf.DATA, "bufr_snocvr_snow.yaml")) | ||
# execute BUFR2IODAX to convert {name} bufr data into IODA format | ||
_gtsbufr2iodax(exe, os.path.join(localconf.DATA, f"bufr_{name}_snow.yaml")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_gtsbufr2iodax(exe, os.path.join(localconf.DATA, f"bufr_{name}_snow.yaml")) | |
_gtsbufr2iodax(exe, gts_yaml) |
In my second (revised diff.txt), I removed the need to construct this again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done the changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Thank you for accepting suggestions.
If I could make one more suggestion that aids in knowing the inputs of this method completely, is to consolidate everything that is needed into localconf
and then only use localconf
everywhere.
At present, you will notice, variables are being accessed from task_config
, runtime_config
as well as localconf
.
Thanks @aerorahul for the detailed instructions, and I have benefited a lot when I was working with you on this PR. |
@aerorahul This PR depends on the NOAA-EMC/GDASApp#602. Would you please take time to review it? Thanks again. |
@jiaruidong2017 |
@aerorahul we need to wait for @CoryMartin-NOAA to merge the recent updates in GDASApp into the feature/stable-nightly, and update the commit hash in the global-workflow. I will let you know when it is ready. Thanks. |
@jiaruidong2017 already done... d347d22 |
Thanks @CoryMartin-NOAA I have updated the commit hash for the GDASApp. |
requested changed were made.
This PR updates the
land_analysis.py
to add the capability to assimilate the madis snow depth data from GTS.This PR depends on GDASApp #602
How has this been tested?
Clone and build on Hera
Cycled test on Hera Run C384/C192 L127 for 2023050100.
Observations on hera at
/scratch1/NCEPDEV/global/Jiarui.Dong/JEDI/GlobalWorkflow/para_gfs/glopara_dump/gdas.20230501/
Checklist